package com.example.helloworld

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment

class ProfileFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_profile, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        
        val versionText = view.findViewById<TextView>(R.id.versionText)
        val gitCommitText = view.findViewById<TextView>(R.id.gitCommitText)
        val buildDateText = view.findViewById<TextView>(R.id.buildDateText)
        val versionName = requireContext().packageManager
            .getPackageInfo(requireContext().packageName, 0).versionName
        versionText.text = "版本号：$versionName"
        
        gitCommitText.text = "Git提交：${BuildConfig.GIT_COMMIT_HASH}"
        buildDateText.text = "编译日期：${BuildConfig.BUILD_DATE}"
    }
} 